package com.education.online.controller;


import com.education.common.utils.ApiReturnObject;
import com.education.online.pojo.OCatalogMenu;
import com.education.online.service.OCatalogMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 目录体系表
 *
 * @date 2020-06-04 15:17:55
 */
@Api(tags = {"PC--目录"})
@RestController
@RequestMapping("/online/ocatalogmenu")
public class OCatalogMenuController {

    @Autowired
    private OCatalogMenuService oCatalogMenuService;

    @ApiOperation(value = "目录接口", httpMethod = "GET")
    @GetMapping("/selectList")
    public ApiReturnObject selectList(Integer parentId){
        List<OCatalogMenu> oCatalogMenuList = oCatalogMenuService.selectOCatalogMenuByParentId(parentId);
//        for (OCatalogMenu oCatalogMenu : oCatalogMenuList) {
//            List<OCatalogMenu> catalogMenuList = oCatalogMenuService.selectOCatalogMenuByParentId(oCatalogMenu.getId());
//            oCatalogMenu.setTwoMenu(catalogMenuList);
//        }
        return new ApiReturnObject("200","success",oCatalogMenuList.size(),oCatalogMenuList);
    }

}
